import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import cesium from 'vite-plugin-cesium';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    cesium(),
  ],
  // devServer: {
  //   host: "localhost",
  //   port: 8080, 
  //   https: false, 
  //   open: true, 
  // },
  server: {
    open: true,//启动项目自动弹出浏览器
    port: 4000,//启动端口
    hmr: true,
    proxy: {
      '/api': {
        target: 'http://localhost:1009',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/zqq': {
        target: 'http://192.168.31.216:5000',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/zqq/, '')
      },
      '/dxc': {
        target: 'http://localhost:1009',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/dxc/, '')
      },
      '/nodd': {
        target: 'http://localhost:3009',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/nodd/, '')
      },
      '/test': {
        target: 'http://localhost:1001',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/test/, '')
      },
      '/go':{
        // 9001
        target: 'http://localhost:9001',	//实际请求地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/go/, '')
      }
    }
  }
})
